-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Implement logic orchestration for Git Pull/Push operations #13518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement logic orchestration for Git Pull/Push operations #13518
Conversation
jabgui/src/main/java/org/jabref/gui/autosaveandbackup/BackupManager.java
Outdated
Show resolved
Hide resolved
…esolver interface to the logic module) JabRef#12350
8302ebc
to
32c30a0
Compare
…remote main branch exists JabRef#12350
…jabref into clean-gsoc-git-support-init
I think we with Oliver would really like to see this PR merged. So I think you can write new features in the follow up PR 😋 |
Regarding the algorithm: Maybe "just" using https://github.com/JabRef/jabref/blob/main/jablib/src/main/java/org/jabref/logic/bibtex/comparator/BibDatabaseDiff.java solves issues? Merging this stats can later help to compare different approaches. Having the approaches here in the PR "hides" them between other discussions. |
Thank you! I’m currently using Only relying on remoteDiffs plus the local map isn’t enough, because it would miss entries that are added or changed only in local. I’ll revise the logic in the follow-up PR |
@trag-bot didn't find any issues in the code! ✅✨ |
Retested on windows - added some fixes because of eclipse-jgit/jgit#155 (comment) |
|
* upstream/main: Issue 13619 Make Citation relations text more clear. (#13620) Explain how to handle notifications (#13630) Fix scope of 'determine issue number' job (#13627) Add proper closing (#13626) Implement logic orchestration for Git Pull/Push operations (#13518) Make pattern for issue number more strict Fix "Cannot load file MultiMergeEntries.fxml" (#13624) Add Copy markdown to copy citation (#13387) Add ADR-0047 (#13621) Initial start of implementing a LSP for integrity checks (#13612) Refactor merge entries package structure (#13614) New Crowdin updates (#13616) BibEntry class no longer implements Cloneable (#13615) Fix dark mode in {} of Citation Relations tab of the entry editor (#13609) Update dependency org.kohsuke:github-api to v2.0-rc.4 (#13611) Fix setting of proxy without password (#13605)
Closes #12350
Final PR based on draft: JabRef#714
This PR implements the logic-layer orchestration for Git push and pull operations with semantic merging support. It enables JabRef to semantically merge .bib files when possible, avoiding manual conflict resolution for simple changes.
This is part of ongoing work to support full Git-based collaboration for .bib files. Further tests and UI integration are planned.
Steps to test
This PR implements the first part of Git sync support by enabling automatic semantic merges when there are no conflicts. The scenario is tested via TDD in GitSyncServiceTest, simulating the following steps:
Since they changed different entries, we expect a clean merge without user intervention. The orchestrator is GitSyncService, and helper utilities and value objects are temporarily located in org.jabref.logic.git.util.
Documentation Supplement
🧩 Table: Git-related Class Responsibilities
GitSyncService
GitHandler
🔧 Key Methods in
GitSyncService
fetchAndMerge(Path)
performSemanticMerge(...)
.bib
content semantically. UsesSemanticMerger
and conflict resolution strategy.push(Path)
📦 Package:
org.jabref.logic.git.io
This package bridges Git and JabRef's BibTeX data model by handling read/write operations for
.bib
files at specific Git revisions.GitFileReader
.bib
text from a specific Git commit.GitFileWriter
BibDatabaseContext
content back to a.bib
file after merge.GitRevisionLocator
base
,local
, andremote
commits for 3-way merge.RevisionTriple
base
,local
, andremote
revisions.📦 Package:
org.jabref.logic.git.status
Handles detection of Git repository and file tracking/sync status. Used before pull/push to determine the correct operation.
GitStatusChecker
.bib
file and return a snapshot.GitStatusSnapshot
SyncStatus
UP_TO_DATE
,BEHIND
,DIVERGED
, etc.).📦 Package:
org.jabref.logic.git.conflicts
Handles semantic conflict detection and resolution strategies during 3-way merge.
SemanticConflictDetector
BibDatabaseContext
s.ThreeWayEntryConflict
GitConflictResolverStrategy
CliConflictResolverStrategy
Conflict Resolution Flow:
Detect conflicts with
SemanticConflictDetector
.If conflicts exist, invoke a
GitConflictResolverStrategy
:In GUI: use
GuiConflictResolverStrategy
In future CLI: use
CliConflictResolverStrategy
Apply merge plan if resolution succeeds.
📦 Package:
org.jabref.logic.git.merge
Executes semantic 3-way merge operations on
.bib
files, including building merge plans and applying field-level changes.MergePlan
SemanticMerger
MergePlan
to a localBibDatabaseContext
.GitSemanticMergeExecutor
performSemanticMerge()
contract.GitSemanticMergeExecutorImpl
GitMergeUtil
💡 GUI Module Integration Note
GUI dependencies are temporarily introduced to reuse the existing
MergeEntriesDialog
for conflict resolution.This is injected via
GitConflictResolverStrategy
to keep the dependency direction correct (logic → gui).A major UI refactor is WIP.
GuiConflictResolverStrategy
MergeEntriesDialog
to let users manually resolve semantic conflicts inBibEntry
s.Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)